package se.ramfelt.psnfriends.model;

import se.ramfelt.psn.model.TrophySummary;
import android.os.Parcel;
import junit.framework.TestCase;

public class ParcelableTrophySummaryTest extends TestCase {

    public void testChildParcable() {
        TrophySummary trophies = new TrophySummary();
        trophies.setBronze(12);
        trophies.setSilver(15);
        trophies.setGold(18);
        trophies.setLevel(90);
        ParcelableTrophySummary parcelable = new ParcelableTrophySummary(trophies);
        Parcel parcel = Parcel.obtain();
        parcelable.writeToParcel(parcel, 0);
        parcel.setDataPosition(0);
        TrophySummary copy = ParcelableTrophySummary.CREATOR.createFromParcel(parcel).getTrophySummary();
        assertNotNull("Marshalled friend copy was null", copy);
        assertEquals(trophies.getBronze(), copy.getBronze());
        assertEquals(trophies.getSilver(), copy.getSilver());
        assertEquals(trophies.getGold(), copy.getGold());
        assertEquals(trophies.getLevel(), copy.getLevel());
        assertEquals(trophies.getPlatinum(), copy.getPlatinum());
    }
}
